var storage = {
    // 设置缓存
    // 设置缓存
    sessionSet: function (name:string, data:any) {
        sessionStorage.removeItem(name)
        sessionStorage.setItem(name, JSON.stringify(data))
    },
    // 获取缓存
    sessionGet: function (name:string) {
        if(!sessionStorage.getItem(name)) return null;
        return JSON.parse(sessionStorage.getItem(name)||"")
    },
    // 清除缓存
    sessionRemove: function (name:string) {
        sessionStorage.removeItem(name)
    },
    // localStorage设置缓存
    // 设置缓存
    localSet: function (name:string, data:any) {
        localStorage.removeItem(name)
        localStorage.setItem(name, JSON.stringify(data))
    },
    // 获取缓存
    localGet: function (name:string) { 
        if(!localStorage.getItem(name)) return null;
        return JSON.parse(localStorage.getItem(name)||"")
    },
    // 清除缓存
    localRemove: function (name:string) {
        localStorage.removeItem(name)
    }

}
export default storage